package com.atguigu.tms.mock;

import com.atguigu.tms.mock.task.ChronoTrigger;
import com.atguigu.tms.mock.task.DimMockTask;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@MapperScan(basePackages = "com.atguigu.tms.mock.mapper")
@Slf4j
public class TmsMockApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(TmsMockApplication.class, args);
        long startMs = System.currentTimeMillis();
        log.info("开始初始化维度模拟任务" );
        DimMockTask dimMockTask = context.getBean(DimMockTask.class);
        log.info(" 完成初始化维度模拟任务："+(System.currentTimeMillis()-startMs)  );
          startMs = System.currentTimeMillis();
        dimMockTask.mainTask();
        log.info("  维度模拟任务完成："+(System.currentTimeMillis()-startMs)  );

        log.info("  事实数据模拟任务："+(System.currentTimeMillis()-startMs)  );
        startMs = System.currentTimeMillis();
        ChronoTrigger chronoTrigger = context.getBean(ChronoTrigger.class);
        log.info("  完成初始化事实数据模拟任务："+(System.currentTimeMillis()-startMs)  );
        startMs = System.currentTimeMillis();
        chronoTrigger.runTime();

    }

}
